﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace DXApplicationTangche.UC.固定资产
{
    public partial class Form资产类别创建 : DevExpress.XtraEditors.XtraForm
    {
        public Form资产类别创建()
        {
            InitializeComponent();
        }

        private void simpleButton上传_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.textBox资产名称.Text)
                || String.IsNullOrEmpty(this.textBox资产卡片类型.Text)
                    || String.IsNullOrEmpty(this.textBox品牌.Text)
                        || String.IsNullOrEmpty(this.textBox用途.Text)
                        )
            {
                MessageBox.Show("填写信息不全");
                return;
            }
            //上传文件
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "pdf,doc,docx|*.pdf;*.doc;*.docx;";
            ofd.Title = "请选择上传文件";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Boolean ifCreate =
                    固定资产Service.createAssertTypeDTO(
                        this.textBox资产名称.Text,
                        this.textBox资产卡片类型.Text,
                        this.textBox品牌.Text,
                        this.textBox用途.Text,
                        ofd
                        );
                if (ifCreate)
                {
                    MessageBox.Show("创建成功");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("创建失败");
                    return;
                }
            }
        }

    }
}